package webserver.standard;

import java.io.IOException;

public class Main
{

	private final static int port = 8080;

	/**
	 * @param args
	 */
	public static void main(String[] args)
	{
		int i = port;

		if (args.length >= 1)
		{
			try
			{
				i = Integer.parseInt(args[0]);
			}
			catch (NumberFormatException e)
			{
				i = port;
				e.printStackTrace();
			}
		}
		try
		{
			Server server = new WebServer(i, new HttpHandlerFactory(), "/");
			server.attachHandlers("", new HttpHandlerFactory());
			server.forwardRequest();
		}
		catch (IOException e)
		{
			e.printStackTrace();
		}
	}
}
